<include file="Public:header" />
<!--主体内容-->
<!--左边-->
<div class="centent_box">
    <include file="Public:left" />
    <!--右边-->
    <div class="centent_right_box">
        <div class="centent_right rightCon">
            <div class="Mtitle">
                <ul>
                    <li class="on"><span>发布客源</span></li>
                </ul>
                <div class="rightWord"><a href="{:U('Cust/index')}">客源管理</a> &gt;&gt; 录入客源</div>
            </div>
            <form id="info_form" action="{:U('Cust/edit')}" method="post" enctype="multipart/form-data">
            <div class="con_div">
                <ul class="formList width2 list_ul">
                    <li>基本信息：</li>
                    <li>
                        <label><span style="color:Red">*</span>类型：</label>
                        <select name="data[demand]" class="selectStyle" validate="required:true" min="1">
                            <option value="0">请选择</option>
                            <option value="1" <if condition="$info['demand'] eq 1">selected</if> >求购</option>
                            <option value="2" <if condition="$info['demand'] eq 2">selected</if> >求租</option>
                        </select>
                    </li>
                    <li>
                        <label><span style="color:Red">*</span>联系人：</label>
                        <input type="text" class="inputStyle width2 required" name="data[title]" value="{$info['title']}" >
                        <label>性别：</label>
                        <select name="data[gender]" class="selectStyle">
                            <option value="0" <if condition="$info['gender'] eq 0">selected</if> >先生</option>
                            <option value="1" <if condition="$info['gender'] eq 1">selected</if> >女士</option>
                        </select>
                    </li>
                    <li>
                        <label><span style="color:Red">*</span>联系电话：</label>
                        <input type="text" class="inputStyle width1 required ismobile" name="data[contact]" value="{$info['contact']}">
                        <label>客户等级：</label>
                        <select name="data[leve]" class="selectStyle" validate="required:true" min="1">
                            <option value="1" <if condition="$info['leve'] eq 1">selected</if> >一级</option>
                            <option value="2" <if condition="$info['leve'] eq 2">selected</if> >二级</option>
                            <option value="3" <if condition="$info['leve'] eq 3">selected</if> >三级</option>
                            <option value="4" <if condition="$info['leve'] eq 4">selected</if> >四级</option>
                            <option value="5" <if condition="$info['leve'] eq 5">selected</if> >五级</option>
                        </select>
                    </li>
                    <li>
                        <label>身份证号：</label>
                        <input type="text" class="inputStyle width1" name="data[id_card]" value="{$info['id_card']}">
                    </li>
                    <li>需求信息：</li>
                    <if condition="$info['estate_id'] eq null">
                        <li class="clear" id="area-sele">
                            <label>区域范围：</label>
                            <select class="selectStyle" name="dd" id="area" onclick="getArea(this)" onchange="seleArea(this)">
                                <option value="0">--请选择--</option>
                                <option value="1">深圳</option>
                            </select>

                        </li>
                        <li class="clear">
                            <label>选择小区：</label>
                            <select class="selectStyle" name="data[estate_id]" id="estate">
                                <option value="0">--请选择--</option>
                            </select>
                            <input type="checkbox" id="around" class="inputStyle width2" style="margin: 3px 5px 0 25px; padding: 0; width: 20px;"  name="data[around]" maxlength="10" value="1">周边

                        </li>
                    <else/>
                        <li>
                            <label>小区名称：</label>
                            <input type="text" class="inputStyle width1" name="tetitle" value="{$info['etitle']}" readonly>
                        </li>

                    </if>

                    <li>
                        <label>面积：</label>
                        <span style="float: left">
                            <input type="number" class="inputStyle width2 input_test required" name="data[area1]" value="{$info['area1']|default=0}" min="0">
                        </span>
                        <span style="float: left; padding: 0 10px;">~</span>
                        <span style="float: left">
                            <input type="number" class="inputStyle width2 input_test required" name="data[area2]" value="{$info['area2']|default=0}" min="0">
                        </span>
                    </li>
                    <li>
                        <label>户型：</label>
                        <span style="float: left"><select name="data[need_type1]" class="selectStyle" validate="required:true" min="0">
                            <option value="0">不限</option>
                            <option value="1" <if condition="$info['need_type1'] eq 1">selected</if> >一室</option>
                            <option value="2" <if condition="$info['need_type1'] eq 2">selected</if> >二室</option>
                            <option value="3" <if condition="$info['need_type1'] eq 3">selected</if> >三室</option>
                            <option value="4" <if condition="$info['need_type1'] eq 4">selected</if> >四室</option>
                            <option value="5" <if condition="$info['need_type1'] eq 5">selected</if> >五室</option>
                            <option value="6" <if condition="$info['need_type1'] eq 6">selected</if> >六室</option>
                            <option value="7" <if condition="$info['need_type1'] eq 7">selected</if> >七室</option>
                            <option value="8" <if condition="$info['need_type1'] eq 8">selected</if> >八室</option>
                            <option value="9" <if condition="$info['need_type1'] eq 9">selected</if> >九室</option>
                        </select></span>
                        <span style="float: left; padding: 0 10px;">~</span>
                        <span style="float: left"><select name="data[need_type2]" class="selectStyle" validate="required:true" min="0">
                            <option value="0" <if condition="$info['need_type2'] eq 0">selected</if> >不限</option>
                            <option value="1" <if condition="$info['need_type2'] eq 1">selected</if> >一室</option>
                            <option value="2" <if condition="$info['need_type2'] eq 2">selected</if> >二室</option>
                            <option value="3" <if condition="$info['need_type2'] eq 3">selected</if> >三室</option>
                            <option value="4" <if condition="$info['need_type2'] eq 4">selected</if> >四室</option>
                            <option value="5" <if condition="$info['need_type2'] eq 5">selected</if> >五室</option>
                            <option value="6" <if condition="$info['need_type2'] eq 6">selected</if> >六室</option>
                            <option value="7" <if condition="$info['need_type2'] eq 7">selected</if> >七室</option>
                            <option value="8" <if condition="$info['need_type2'] eq 8">selected</if> >八室</option>
                            <option value="9" <if condition="$info['need_type2'] eq 9">selected</if> >九室</option>
                        </select></span>
                    </li>
                    <li>
                        <label>朝向：</label>
                        <select name="data[aspect]" class="selectStyle" validate="required:true" min="0">
                            <option value="0">不限</option>
                            <option value="1" <if condition="$info['aspect'] eq 1">selected</if> >东</option>
                            <option value="2" <if condition="$info['aspect'] eq 2">selected</if> >南</option>
                            <option value="3" <if condition="$info['aspect'] eq 3">selected</if> >西</option>
                            <option value="4" <if condition="$info['aspect'] eq 4">selected</if> >北</option>
                            <option value="5" <if condition="$info['aspect'] eq 5">selected</if> >东西</option>
                            <option value="6" <if condition="$info['aspect'] eq 6">selected</if> >南北</option>
                            <option value="7" <if condition="$info['aspect'] eq 7">selected</if> >东南</option>
                            <option value="8" <if condition="$info['aspect'] eq 8">selected</if> >东北</option>
                            <option value="9" <if condition="$info['aspect'] eq 9">selected</if> >西南</option>
                            <option value="10" <if condition="$info['aspect'] eq 10">selected</if> >西北</option>
                        </select>
                    </li>
                    <li>
                        <label>价格：</label>
                        <span style="float: left;">
                            <input type="number" class="inputStyle width2 input_test" name="data[price1]" min="0" value="{$info['price1']|default=0}">
                        </span>
                        <span style="float: left; padding: 0 10px;">~</span>
                        <span style="float:left;">
                            <input type="number" class="inputStyle width2 input_test required" name="data[price2]" min="0" value="{$info['price2']|default=0}">
                        </span>
                    </li>
                    <li>
                        <label>楼层：</label>
                        <span style="float: left; padding: 0px;">
                            <input type="number" class="inputStyle width2 input_test" name="data[fool_scope1]" value="{$info['fool_scope1']|default=0}" min="0">
                        </span>
                        <span style="float: left; padding: 0 10px;">~</span>
                        <span style="float: left; padding: 0px;">
                            <input type="number" class="inputStyle width2 input_test" name="data[fool_scope2]" value="{$info['fool_scope2']|default=0}" min="0">
                        </span>
                        <label>总楼层：</label>
                        <select name="data[fool_total]" class="selectStyle">
                            <option value="0">不限</option>
                            <option value="1" <if condition="$info['fool_total'] eq 1">selected</if> >小于等于8层</option>
                            <option value="2" <if condition="$info['fool_total'] eq 2">selected</if> >大于8层</option>
                        </select>
                    </li>
                    <li>
                        <label>备注：</label>
                        <input type="text" class="inputStyle input_test" name="data[remark]" placeholder="备注" value="{$info.remark}" >
                    </li>
                    <li>
                        <label></label>
                        <input type="submit" value="提 交" class="btnStyle">
                    </li>
                </ul>
            </div>
            </form>
        </div>
    </div>
</div>
<script src="__S__/js/jquery.validate.js"></script>
<script src="__S__/js/magess.js"></script>
<script src="__S__/js/jquery.metadata.js"></script>
<script type="text/javascript">
    $().ready(function() {
        $("#info_form").validate();
        jQuery.validator.addMethod("ismobile", function(value, element) {
            var length = value.length;
            var mobile = /^(13[0-9]{9})|(18[0-9]{9})|(14[0-9]{9})|(17[0-9]{9})|(15[0-9]{9})$/;
            return this.optional(element) || (length == 11 && mobile.test(value));
        }, "请正确填写您的手机号码");
    });
</script>
<script type="text/javascript">
    function getArea (tar){
        var areaid = $(tar).val();
        var sele = $(tar);
        if (areaid == 0) {
            $(sele).nextAll('select').remove();
            $('#estate option[value=0]').nextAll('option').remove();
            return false;
        }
        var url = "{:U('Ajax/getArea')}", data = {areaid:areaid};
        $.post (url, data, function (response){
            var html = '';
            if (response.state == 'ok'){
                var data = response.data;
                html = '<select class="selectStyle" name="area" onclick="getArea(this)" onchange="seleArea(this)"><option value="0">--请选择--</option>';
                $.each(data, function (i, v){
                    html += '<option value="'+v.id+'">'+v.name+'</option>';
                });
                html += '</select>';
            }
            $(sele).nextAll('select').remove();
            $('#area-sele').append(html);
        }, 'json');
    }
    function seleArea(tar) {
        var sele_val = $(tar).val();
        var url = "{:U('Ajax/getEstate')}";
        var data = {area_id:sele_val};
        $.post (url, data, function (response){
            if (response.status == 1){
                var html = '';
                var data = response.data;
                $.each (data, function (i,v){
                    html += '<option value="'+v.id+'">'+v.title+'</option>';
                });
                $('#estate option[value=0]').nextAll('option').remove();
                $('#estate').append(html);
            }
        },'json');
    };
</script>
<include file="Public:footer" />